(display "\n========================================\n")
(define (element-of-set? x set)
    (cond   ((null? set) #f)
            ((equal? x (car set)) #t)
            (else (element-of-set? x (cdr set)))))
; (display (element-of-set? 2 (list 2 3 4)))

(define (adjoin-set x set)
        (cons x set))
; (display (adjoin-set 3 (list 1 2)))

(define (intersection-set set1 set2)
    (cond   ((or (null? set1) (null? set2)) '())
            ((element-of-set? (car set1) set2)
                (cons (car set1)
                      (intersection-set (cdr set1) set2)))
            (else (intersection-set (cdr set1) set2))))
; (display (intersection-set (list 1 2 3) (list 3 4 5)))

(define (union-set set1 set2)
    (append set1 set2))

(display (union-set (list 1 2 3 4 ) (list 2 3 4 5 6)))

; 复杂度：
; element-of-set?：没变, O(n)
; intersection-set：没变, O(n^2)
; adjoin-set：O(1)
; union-set：O(n)
(display "\n========================================\n")
